package top.yokey.shopnc.model;

import top.yokey.base.base.BaseHttpClient;
import top.yokey.base.base.BaseHttpListener;

@SuppressWarnings("ALL")
public class MemberCartModel {

    private final String ACT = "member_cart";
    private static volatile MemberCartModel instance;

    public static MemberCartModel get() {
        if (instance == null) {
            synchronized (MemberCartModel.class) {
                if (instance == null) {
                    instance = new MemberCartModel();
                }
            }
        }
        return instance;
    }

    public void cartList(BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "cart_list")
                .post(baseHttpListener);

    }

    public void cartDel(String cartId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "cart_del")
                .add("cart_id", cartId)
                .post(baseHttpListener);

    }

    public void cartAdd(String goodsId, String quantity, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "cart_add")
                .add("goods_id", goodsId)
                .add("quantity", quantity)
                .post(baseHttpListener);

    }

    public void cartEditQuantity(String cartId, String quantity, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "cart_edit_quantity")
                .add("cart_id", cartId)
                .add("quantity", quantity)
                .post(baseHttpListener);

    }

}
